//
// Copyright (C) Microsoft. All rights reserved.  
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not 
// use this file except in compliance with the License.  You may obtain a copy 
// of the License at http://www.apache.org/licenses/LICENSE-2.0  
// 
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
// WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
// MERCHANTABLITY OR NON-INFRINGEMENT. 
//
// See the Apache License, Version 2.0 for specific language governing 
// permissions and limitations under the License.
//
//
#include "quad_common.hlsli"

static const float PI = 3.14159265f;

struct vertexShaderInput
{
    float4 point0 : POSITION0;
    float2 uv0 : TEXCOORD0;
};

struct vertexShaderOutput
{
    float4 point0 : SV_Position;
    float2 uv0 : TEXCOORD;
};

vertexShaderOutput main(vertexShaderInput v) 
{
    vertexShaderOutput result;

    float2 t1 = v.point0.xy - origin;
    float2 t2;
    t2.x = rotation.x * t1.x + rotation.y * t1.y;
    t2.y = rotation.z * t1.x + rotation.w * t1.y;
    float2 t3 = t2 + origin;

    result.point0.x = t3.x / (targetDimensions.x/2);
    result.point0.y = t3.y / (targetDimensions.y/2);
    result.point0.zw = float2(0.5f, 1.f);

    result.uv0 = v.uv0;

    return result;
}